package com.zs4sdk.common;

import android.content.Context;
import android.util.Log;

import com.reyun.tracking.sdk.Tracking;

/**
 * Created by Administrator on 2018/4/27.
 */

public class Zs4GameUtil {
    public final static String LOGINE_CACHE_NAME = "zs4GameLoginFile";
    public final static String IS_LOGIN_KEY = "isLogin";
    public final static String LOGIN_NAME = "login_name";
    public static void saveLoginStatus(Context context,String user_id,boolean isLogin){
        Zs4GameSharePreferences zs4GameSharePreferences  = new Zs4GameSharePreferences(context,LOGINE_CACHE_NAME);
        zs4GameSharePreferences.putString(LOGIN_NAME,user_id);
        zs4GameSharePreferences.putBoolean(user_id,isLogin);
    }

    public static boolean getUserIdIsLogin(Context context,String user_id){
        Zs4GameSharePreferences zs4GameSharePreferences  = new Zs4GameSharePreferences(context,LOGINE_CACHE_NAME);
        String loginName = zs4GameSharePreferences.getString(LOGIN_NAME);
        if(!loginName.equals(user_id)){
            return false;
        }else{
            boolean is = zs4GameSharePreferences.getBoolean(loginName);
            Log.e("login"," isLogin is "+is);
            return is;
        }
    }

    public static void clearLoginStatus(Context context){
        Zs4GameSharePreferences zs4GameSharePreferences  = new Zs4GameSharePreferences(context,LOGINE_CACHE_NAME);
        zs4GameSharePreferences.clear();
    }

}
